#!/usr/bin/env python3
# -*- coding=utf-8 -*-
# 题目：求1+2!+3!+...+20!的和。

def f1():
    n = 20
    a = [1]
    for i in range(2, n+1):
        a.append(a[-1])
        a[-1] *= i

    r = 0
    for i in a:
        r += i
    print(r)


f = f1
if __name__ == "__main__":
    f()
